package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.MarketFenleiBean;
import com.lwj.liwanjia.impl.MarketleftView;
import com.lwj.liwanjia.model.MarketModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/9/25.
 */

public class MarketPresenter {
    private MarketleftView marketleftView;
    private MarketModel marketModel;

    public MarketPresenter(MarketleftView marketleftView) {
        this.marketleftView = marketleftView;
        marketModel = new MarketModel();
    }

    public void getMarketData() {
        if (marketleftView != null) {
            marketModel.getMarketData( new Subscriber<MarketFenleiBean>() {
                @Override
                public void onCompleted() {
                }

                @Override
                public void onError(Throwable e) {
                    marketleftView.showError((Exception) e);
                }

                @Override
                public void onNext(MarketFenleiBean marketFenleiBean) {
                    marketleftView.getMarketData(marketFenleiBean);
                }
            });
        }
    }
}
